<?php

namespace app\index\controller;

use app\common\YujisoController;

class Shoponstock extends YujisoController
{
     public function __construct()
    {
        parent::__construct();
    }

    public function getList()
    {
      $list= \app\index\service\ShoponstockService::getList($this->param);
        exitJson($list);
    }
    //批量处理确认
    public function batchConfirm(){
        $param=$this->param;
        $updateData=[];
        if($param['id']){
            foreach($param['id'] as $key=>$value){
                $valueArr=explode('_',$value);
                $updateData[]=['sku'=>$valueArr[1],'code'=>$valueArr[0],'status'=>2,'operator'=>CN_NAME,"operate_time"=>date('Y-m-d H:i:s')];
            }
            try{
              \app\common\model\ToolModel::dbInsertOrUpdate('confirm_shoponway', $updateData);
            }catch (\Exception $e){
                ToolModel::rollback();
                return returnJson(0,'失败'.$e->getMessage());
            }
        }
        returnJson('1','处理成功');
    }
}
